﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.Caching;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using SalePartial.BLL;
using SalePartial.Model;
using SalePartial.Utility.WebComponents;

public partial class controls_front_TechNeed : System.Web.UI.UserControl
{
    //private SalePartial.BLL.TradeNeed needBll = new SalePartial.BLL.TradeNeed();
    private DateTime expireTime = DateTime.Now.AddMinutes(0);

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            bind();
        }
    }

    private void bind()
    {
        //水技?
        string cacheKey1 = "limitNeeds1";
        if (Cache[cacheKey1] != null)
        {
            this.needList1.DataSource = (IEnumerable)Cache[cacheKey1];
        }
        else
        {
            //IList list1 = needBll.GetNeedListByLimitAndType(10, 1);  //水技?
            //Cache.Add(cacheKey1, list1, null, expireTime, TimeSpan.Zero, CacheItemPriority.High, null);
            //this.needList1.DataSource = list1;
        }

        this.needList1.DataBind();

        //固?技?
        string cacheKey2 = "limitNeeds2";
        if (Cache[cacheKey2] != null)
        {
            this.needList2.DataSource = (IEnumerable)Cache[cacheKey2];
        }
        else
        {
            //IList list2 = needBll.GetNeedListByLimitAndType(4, 2);  //固?技?
            //Cache.Add(cacheKey2, list2, null, expireTime, TimeSpan.Zero, CacheItemPriority.High, null);
            //this.needList2.DataSource = list2;
        }

        this.needList2.DataBind();

        //大气技?
        string cacheKey3 = "limitNeeds3";
        if (Cache[cacheKey3] != null)
        {
            this.needList3.DataSource = (IEnumerable)Cache[cacheKey3];
        }
        else
        {
            //IList list3 = needBll.GetNeedListByLimitAndType(4, 3);  //大气技?
            //Cache.Add(cacheKey3, list3, null, expireTime, TimeSpan.Zero, CacheItemPriority.High, null);
            //this.needList3.DataSource = list3;
        }

        this.needList3.DataBind();

        //其它技?
        string cacheKey4 = "limitNeeds4";
        if (Cache[cacheKey4] != null)
        {
            this.needList4.DataSource = (IEnumerable)Cache[cacheKey4];
        }
        else
        {
            //IList list4 = needBll.GetNeedListByLimitAndType(3, 4);  //其它技?
            //Cache.Add(cacheKey4, list4, null, expireTime, TimeSpan.Zero, CacheItemPriority.High, null);
            //this.needList4.DataSource = list4;
        }

        this.needList4.DataBind();
    }
}
